package cn.iocoder.yudao.module.pickbook.service.checkin;

import cn.iocoder.yudao.module.pickbook.dal.dataobject.checkin.PickbookCheckinDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;

import java.time.LocalDate;
import java.util.List;

/**
 * 打卡记录 Service 接口
 *
 * @author 芋道源码
 */
public interface PickbookCheckinService {

    /**
     * 创建打卡记录
     *
     * @param userId 用户ID
     * @param bookId 绘本ID
     * @param chapterId 章节ID
     * @param classId 班级ID
     * @param readingTime 阅读时长
     * @param pagesRead 阅读页数
     * @param notes 阅读笔记
     * @return 打卡记录
     */
    PickbookCheckinDO createCheckin(Long userId, Long bookId, Long chapterId, Long classId,
                                   Integer readingTime, Integer pagesRead, String notes);

    /**
     * 获取用户今日是否已打卡
     *
     * @param userId 用户ID
     * @param date 日期
     * @return 是否已打卡
     */
    boolean hasCheckedInToday(Long userId, LocalDate date);

    /**
     * 获取用户打卡记录列表
     *
     * @param userId 用户ID
     * @param pageNo 页码
     * @param pageSize 每页大小
     * @return 打卡记录列表
     */
    PageResult<PickbookCheckinDO> getUserCheckins(Long userId, Integer pageNo, Integer pageSize);

    /**
     * 获取用户打卡统计
     *
     * @param userId 用户ID
     * @return 统计信息
     */
    CheckinStats getCheckinStats(Long userId);

    /**
     * 获取班级打卡记录
     *
     * @param classId 班级ID
     * @param pageNo 页码
     * @param pageSize 每页大小
     * @return 打卡记录列表
     */
    PageResult<PickbookCheckinDO> getClassCheckins(Long classId, Integer pageNo, Integer pageSize);

    /**
     * 获取用户打卡日历数据
     *
     * @param userId 用户ID
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 打卡日期列表
     */
    List<LocalDate> getCheckinCalendar(Long userId, LocalDate startDate, LocalDate endDate);

    /**
     * 打卡统计信息
     */
    class CheckinStats {
        private Integer totalDays;
        private Integer totalBooks;
        private Integer todayBooks;
        private Integer weekBooks;
        private Integer monthBooks;

        // getters and setters
        public Integer getTotalDays() { return totalDays; }
        public void setTotalDays(Integer totalDays) { this.totalDays = totalDays; }
        public Integer getTotalBooks() { return totalBooks; }
        public void setTotalBooks(Integer totalBooks) { this.totalBooks = totalBooks; }
        public Integer getTodayBooks() { return todayBooks; }
        public void setTodayBooks(Integer todayBooks) { this.todayBooks = todayBooks; }
        public Integer getWeekBooks() { return weekBooks; }
        public void setWeekBooks(Integer weekBooks) { this.weekBooks = weekBooks; }
        public Integer getMonthBooks() { return monthBooks; }
        public void setMonthBooks(Integer monthBooks) { this.monthBooks = monthBooks; }
    }

} 